#ifndef __MCS__INVALID_ARGUMENT_EXCEPTION__HPP
#define __MCS__INVALID_ARGUMENT_EXCEPTION__HPP

#include "ScriptException.hpp"

class InvalidArgumentException : public ScriptException
{
public:
	InvalidArgumentException(String functionSign, size_t argNo, String argName, ptr<Value> val, String message = String())
		: ScriptException()
		, functionSign_(functionSign)
		, argNo_(argNo)
		, argName_(argName)
		, value_(val)
		, message_(message)
	{}

	virtual InvalidArgumentException * clone() const { return new InvalidArgumentException(*this); }

	virtual std::ostream & stream(std::ostream & str) const
	{
		return str << "Argument #" << argNo_ << " \"" << argName_ << "\" of function \"" << functionSign_ << "\" has invalid value: " << message_;
	}
private:
	String functionSign_;
	size_t argNo_;
	String argName_;
	ptr<Value> value_;
	String message_;
};

#endif //__MCS__INVALID_ARGUMENT_EXCEPTION__HPP
